﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.SEO.Model;
using com.SEO.DataAccess;

namespace Helper.Bussiness
{
    public class RankManage : BaseManage
    {
        public RankManage()
        {
        
        }

        public int AddRankInfo(RankInfo info, string connName = ConnectionName)
        {
            RankCtrl ctrl = new RankCtrl();
            return ctrl.Insert(connName, info);
        }

        public int UpdateRankInfo(RankInfo info, string connName = ConnectionName)
        {
            RankCtrl ctrl = new RankCtrl();
            return ctrl.UpDate(connName, info);
        }

        public RankInfo GetRankInfoByID(string objectID, string connName = ConnectionName)
        {
            RankCtrl ctrl = new RankCtrl();
            List<RankInfo> lstRankInfo = ctrl.SelectAsList(connName, "RankID = '" + objectID + "'");
            if (lstRankInfo.Count > 0)
            {
                return lstRankInfo[0];
            }

            return null;
        }

        public List<RankInfo> getRankInfoByCondition(string strCondition, string connName = ConnectionName)
        {
            RankCtrl ctrl = new RankCtrl();
            return ctrl.SelectAsList(connName, strCondition);
        }

        public void DeleteRankInfo(RankInfo info, string connName = ConnectionName)
        {
            RankCtrl ctrl = new RankCtrl();
            ctrl.Delete(connName, info.KeywordId.ToString());
        }
    }
}
